/**
 * package: services
 * author: zhaiyujin
 * description:
 */
package services

import (

	"github.com/kataras/iris/v12"

	"huanteng/web/repositories"
)

type TestService interface {
	Create(ctx iris.Context) error //新增
	RoleList(ctx iris.Context)  //获取列表
	Delete(id uint) //删除
	Update(id uint,ctx iris.Context)(err error) //更新

}

type roleService struct {
	repo  repositories.RoleRepository

}



func NewTestService (repo repositories.RoleRepository) TestService{
	return &roleService{
		repo:repo,
	}
}

func (a *roleService) Delete(id uint)  {
	//a.repo.Delete(id)
}
func (a *roleService)Update(id uint,ctx iris.Context)(err error) {
	//user:= models.Role{}
	//  err=a.saveRole.Validate(ctx,&user)

	//a.repo.Update(id,&user)
	return nil
}
func (a *roleService)RoleList(ctx iris.Context){
	/*model:=[]models.Role{}
	a.repo.RoleList(ctx,&model)*/

}
func (a *roleService)Create(ctx iris.Context) (err error)  {
/*	model:=models.Role{}
	err=validator.ValidateInfo(ctx.ReadJSON(&model))
	if err!=nil{
		return
	}
	role:=a.repo.FindByName(model.Name)
	if role.ID!=0{
		err=errors.New("角色名称已经存在了");
		return
	}


	a.repo.Create(&model)

	*/
	return nil
}


